import React, { Component } from 'react';
import qs from "qs";

const DetailData=[
    {
        id:"01",content:"你好，中国"
    },
    {
        id:"02",content:"你好，EDG"
    },
    {
        id:"03",content:"你好，未来的自己"
    }
];
export default class Detail extends Component {
    render() {
        // console.log(this.props);
        // const {id,title}=this.props.match.params;

        // console.log(qs.parse(this.props.location.search.slice(1)));
        // const {id,title}=qs.parse(this.props.location.search.slice(1));

        const {id,title}=this.props.location.state || {};
        const findRes=DetailData.find((item)=>{
            return item.id === id;
        }) || {};
        return (
            <ul>
                <li>ID:{id}</li>
                <li>TITLE:{title}</li>
                <li>CONTENT:{findRes.content}</li>
            </ul>
            // <ul>
            //     111
            // </ul>
        );
    };
};
